<?php
/*
+--------------------------------------------------------------------------
|   phpBIZ v3.0  full version
|   ========================================
|   by taft@wjl.cn yejun@wjl.cn
|   http://www.phpbiz.cn http://www.wjl.cn
|   all rights reserved
+---------------------------------------------------------------------------
|
|   > 最后修改日期：2005-4-30 2006-2-8
|
+--------------------------------------------------------------------------
*/
!class_exists('Debug') && exit('Forbidden');
$idx = new Statics;

class Statics
{
	function Statics()
	{
		global $INCOME,$DB,$BIZ;
		
		$BIZ -> assign("code",$INCOME[code]);
		switch($INCOME[code])
		{
			case 'seller':
				$this -> seller_form();
				break;
			case 'shop':
				$this -> shop_form();
				break;
			default:
				$this ->simple_form();
				break;
		}
		$BIZ -> output("Static.tpl");
	}
	function simple_form()
	{
		global $INCOME,$DB,$BIZ;

		$DB -> db_query(" (SELECT count(*) AS ct FROM biz_seller) UNION ALL  (SELECT count(*) AS ct FROM biz_goods) UNION ALL (SELECT count(*) AS ct FROM biz_goods WHERE goods_mark_sell =1) UNION ALL (SELECT count(*) AS ct FROM biz_session) UNION ALL (SELECT count(*) AS ct FROM biz_session WHERE seller_id<>0)  UNION ALL (SELECT count(*) AS ct FROM biz_session WHERE seller_id=0)");

		while( $r = $DB->db_fetch_row() )
		{
			$simple[] = $r['ct'];
		}
		$BIZ ->assign("simple",$simple);

		return;
	}
	function seller_form()
	{
		global $DB,$BIZ;
		$s=array();
		$DB -> db_query("SELECT b.seller_logaccount, b.seller_logaccount,a.seller_id as seller_id, a.property_id, a.goods_total as goods_total FROM biz_seller_data a,biz_seller  b where a.seller_id=b.seller_id order by a.goods_total desc,a.property_id desc limit 0,20");
		while( $r = $DB->db_fetch_row() )
		{
			$s[] = array ($r['seller_id'],$r['goods_total'],$r['seller_logaccount'],$r['seller_logaccount']);
		}
		$BIZ ->assign("sortSeller",$s);

		return;
	}
	function shop_form()
	{
		global $DB,$BIZ;
		$s=array();
		$DB -> db_query("select * from biz_shop order by shop_visit_count desc limit 0,20");
		while( $r = $DB->db_fetch_row() )
		{
			$s[] = array( $r['shop_id'],$r['shop_name'],$r['shop_location'],$r['shop_telephone']);
		}
		$BIZ ->assign("sortShop",$s);

		return;
	}
}
?>